fix(core): apply named function pattern to useEffect calls#347
Open
eunwoo-levi wants to merge 7 commits intotoss:mainfrom
Open
fix(core): apply named function pattern to useEffect calls#347eunwoo-levi wants to merge 7 commits intotoss:mainfrom
eunwoo-levi wants to merge 7 commits intotoss:mainfrom
Conversation
zztnrudzz13
reviewed
Mar 17, 2026
Collaborator
zztnrudzz13
left a comment
There was a problem hiding this comment.
This is a great PR — we’re planning to merge it soon. Could you please add a changeset?
Author
|
@zztnrudzz13 Added a changeset! Thank you for the review :) |
zztnrudzz13
approved these changes
Mar 17, 2026
Collaborator
zztnrudzz13
left a comment
There was a problem hiding this comment.
Great! Thank you for contributing!
There was a problem hiding this comment.
Pull request overview
This PR updates several core hooks to use named function expressions for useEffect callbacks, aligning with the project standard documented in CLAUDE.md and improving stack traces/readability.
Changes:
- Replaced anonymous arrow callbacks in
useEffectwith named functions across multiple hooks. - Preserved existing effect logic while improving debuggability.
- Added a patch changeset documenting the behavioral-neutral internal refactor.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/hooks/usePreservedCallback/usePreservedCallback.ts | Replaces useEffect arrow callback with a named function to improve stack traces. |
| packages/core/src/hooks/useLoading/useLoading.ts | Uses a named function for the mounted-state tracking effect. |
| packages/core/src/hooks/useInterval/useInterval.ts | Names the immediate-run and interval-start effects for clearer stack traces. |
| packages/core/src/hooks/useDebouncedCallback/useDebouncedCallback.ts | Converts the unmount cleanup effect to a named function. |
| packages/core/src/hooks/useDebounce/useDebounce.ts | Converts the unmount cancel effect to a named function. |
| .changeset/pretty-candles-wink.md | Adds a patch changeset entry describing the refactor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Apply the named function pattern to
useEffectcallbacks across multiple hooks to comply with the project's coding standards.Summary
CLAUDE.mdexplicitly requires named functions inuseEffect:Changes
function syncCallbackRef()function runImmediateCallback(),function startInterval()function cancelDebouncedOnUnmount()function clearDebouncedOnUnmount()function trackMountedState()Checklist
yarn run fixto format and lint the code and docs?yarn run test:coverageto make sure there is no uncovered line?